package com.ghsc.ghxc.jsb.ui.live.activity

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.live.bean.RedDetailsResult
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.live.activity
 * 类名：RedExtensionIndexVideModel
 * 创建时间：2024/5/23 19:06
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class RedExtensionIndexVideModel  : BaseViewModel() {

    /**
     *  红包详情
     */
    var onPacketDetailData = MutableLiveData<BaseResponse<RedDetailsResult>>()
    fun onPacketDetailMethod(paras:String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onPacketDetailData(paras) }
            executeResponse(
                response,
                { onPacketDetailData.value = response },
                { againLoginMsg.value = response.msg }
            ) { getRewardErrorData.value = response }
        }
    }


}